<?php
/**
 * Модель user_to_shop
 * 
 * Класс модели
 * @author Anton Zavidov
 * @package myLiveShop
 */

/**
 * Модель user_to_shop
 *
 */
class ModelUser_to_shop extends Model {
	
	const TABLE				= 'user_to_shop';
	const F_USER_ID  	= 'user_id';
	const F_SHOP_ID  	= 'shop_id';
	const F_MODE  	= 'mode';
	const F_SETTINGS  	= 'settings';
			
	public function __construct($className=null){
		parent::__construct(__CLASS__);
		$this->name='user_to_shop';
		$this->id_field=array(self::F_USER_ID,self::F_SHOP_ID);
		$this->fields=array(
		self::TABLE.DOT.self::F_USER_ID=> new Field($this,self::F_USER_ID,self::TABLE,array(
				'important'=>true,
				'lenght'=>11,
				'join_table'=>'user')),
		self::TABLE.DOT.self::F_SHOP_ID=> new Field($this,self::F_SHOP_ID,self::TABLE,array(
				'important'=>true,
				'lenght'=>9,
				'join_table'=>'shop')),
		self::TABLE.DOT.self::F_MODE=> new Field($this,self::F_MODE,self::TABLE,array(
				'lenght'=>1,
				'validate_type'=>Validator::VALIDATE_BOOL)),
		self::TABLE.DOT.self::F_SETTINGS=> new Field($this,self::F_SETTINGS,self::TABLE,array(
				'type'=>Field::TYPE_TEXT))		);
	}
}
